{{define "content"}}
<div class="page-title-box">
    <div class="row align-items-center">
        <div class="col-auto">
            <h2 class="page-title">编辑别名</h2>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-12">
        <form id="agent" class="card" method="post">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-6">
                        <div class="mb-2">
                            <label class="form-label">别名</label>
                            <input name="alias" type="text" class="form-control" placeholder="请输入名称" value="{{.Agent.Alias}}" required>
                        </div>
                    </div>
                </div>
            </div>
            <div class="card-footer text-right">
                <input name="id" type="hidden" value="{{.Agent.ID}}">
                <button type="submit" class="btn btn-primary">提交</button>
                <a href="{{.BackUrl}}" class="btn btn-danger ml-2">返回</a>
            </div>
        </form>
    </div>
</div>
{{end}}
{{define "script"}}
<script type="text/javascript">
    $(document).ready(function () {
        $("#agent").on("submit", function (event) {
            $('#agent').ajaxSubmit({
                url: "/agent/update",
                dataType: "json",
                timeout: 60000,
                success: function (data) {
                    if (data.code == 200) {
                        window.location.href = "/agent/list";
                    } else {
                        alert(data.message);
                    }
                }
            })
            return false;
        });
    });
</script>
{{end}}